package edu.syr.iis.web.model;

import java.util.Collection;

public class TextSegmentationEvaluation {
	
	static final int K = 10;  /* Window Size */
	
	double windowDiff;
	
	
	/*
	 *  WindowDidff is defined as follows by Pevzner and Hearst, 2002
	 *  
	 *  WindowDiff(ref,hyp) = (1 / N - k ) * Sum_{i = 1 to N-K} |b_{ref}(i,i+k) - b_{hyp}(i,i+k)|>0)
	 */
	public TextSegmentationEvaluation (User u1, User u2, Message message)
	{
		int n = message.content.split("(\\s+)").length;
		int total = 0;
		
		for (int i = 0; i < n - K; i++)
		{
			int b1 = message.getNumberOfBoundaries(u1, i, i + K);
			int b2 = message.getNumberOfBoundaries(u2, i, i + K);
			
			if (b1 == b2)
				total++;			
		}
		
		windowDiff = (1 / n - K) * total;
		
	}

	
	public TextSegmentationEvaluation (User u1, User u2, Conversation conversation)
	{

	}

	
	public TextSegmentationEvaluation (User u1, User u2, Collection<Conversation> conversations)
	{
		
		
	}

}
